<form role="form" method="post" action="<?=site_url('storage/search') ?>">
  <div class="form-group">
    <label for="exampleInputEmail1" id="searchWithProduct">Find shelve</label>
    <input type="text" class="form-control" id="exampleInputEmail1" placeholder="Enter shelve (E.g: A1)" name="shelve">
  </div>    
</form>

<form role="form" method="post" action="<?=site_url('storage/filter') ?>">
  <span class="help-block">Filter</span>
  <div class="btn-group">	    
  	<select class="form-control" name="filter">
	  <option value="all">--Filter shelve--</option>
	  <option value="empty" <?=(isset($filterSelected) && ($filterSelected == 'empty')) ? 'selected="selected"' : '' ?>>Empty</option>
	  <option value="available" <?=(isset($filterSelected) && ($filterSelected == 'available')) ? 'selected="selected"' : '' ?>>Available</option>
	  <option value="nearlyfull" <?=(isset($filterSelected) && ($filterSelected == 'nearlyfull')) ? 'selected="selected"' : '' ?>>Nearly Full</option>
	  <option value="full" <?=(isset($filterSelected) && ($filterSelected == 'full')) ? 'selected="selected"' : '' ?>>Full</option>
	</select>
  </div>
  <button type="submit" name="filterBtn" class="btn btn-primary">Filter</button>
</form>

<form role="form" method="post" action="<?=site_url('storage/process') ?>">
  <!-- Create new shelve -->
  <span class="help-block">Add new shelve</span>
  <div class="row">
	  <div class="col-xs-2">
	    <input type="text" name="shelve" class="form-control" placeholder="New shelve">
	  </div>
	  <div class="col-xs-2">
	    <input type="text" name="quantity" class="form-control" placeholder="Quantity">
	  </div>
	  <button type="submit" name="addShelveBtn" class="btn btn-primary">Add</button>
  </div>  
</form>

<div class="table-responsive">
	<table class="table">
		<thead>
			<tr align="center">										
				<td>Section</td>
				<td>Codes</td>			
				<td>Qty</td>				
				<td colspan="3">Status</td>				
			</tr>
		</thead>
		<tbody>			
			<?php				
				foreach($storage as $shelve):
			?>
			<tr align="center">	
				<td><?=$shelve['title'] ?></td>								
				<td><?=$shelve['codes'] ?></td>
				<td><?=$shelve['quantity'] ?></td>								
				<!-- Empty | Available | Nearly Full | Full  -->
				<?php
					$status = $shelve['status'];

					if($status == 'empty')
					{
						$statusBtn = '<button type="button" class="btn btn-default">'.$status.'</button>';
						echo "<td>$statusBtn</td><td></td><td></td><td></td>";
					}
					else if($status == 'available')
					{
						echo "<td></td><td>$status</td><td></td><td></td>";
					}
					else if($status == 'nearlyfull')
					{
						echo "<td></td><td></td><td>$status</td><td></td>";
					}
					else if($status == 'full')
					{
						echo "<td></td><td></td><td></td><td>$status</td>";
					}
				?>				
			</tr>
			<?php
				endforeach;
			?>
		</tbody>
	</table>
</div>